<?php

namespace App\Models;

class Category extends Base
{
    protected $table = 'categorys';

    const STATUS_1 = 1;
    const STATUS_2 = 2;

    const STATUS_TEXT = [
        self::STATUS_1 => '<span class="el-tag">正常</span>',
        self::STATUS_2 => '<span class="el-tag el-tag--danger">锁定</span>',
    ];

    protected $fillable = [
        'id','name','pid','status'
    ];

    public $timestamps = false;//关闭自动维护




    /**
     * 获取列表
     * @return mixed
     */
    protected function getList(){
        $lists = $this->get();
        $this->stateToText($lists,[
            'status' => self::STATUS_TEXT,
        ]);
        $lists = $lists->toArray();
        $menus = $this->toFormatTree($lists,'name');
        return $menus;
    }


}
